//
//  XDLMMyCell.m
//  xindailianmeng
//
//  Created by 张东 on 2017/2/7.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDLMMyCell.h"
#import "UIButton+Extension.h"
@implementation XDLMMyCell

- (void)cellWithCellArr:(NSArray *)array indexPath:(NSIndexPath *)indexpath {
  
    self.imageView.image = [UIImage imageNamed:array[indexpath.section][indexpath.row][0]];
    [self setSeparatorInset:UIEdgeInsetsMake(0, 15, 0, 15)];
    self.textLabel.textColor = kColorRGB(102,102,102);
    self.textLabel.font = kBaseFont_(15);
    if (array.count > 3) {
        if (indexpath.section == 3) {
        
           [self cellCofWithArr:array indexpath:indexpath];
        
        }else {
            self.textLabel.text = array[indexpath.section][indexpath.row][1];
            self.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nextInd"]];
        }
    } else {
        if (indexpath.section == 2) {
            [self cellCofWithArr:array indexpath:indexpath];
        }else {
            self.textLabel.text = array[indexpath.section][indexpath.row][1];
            self.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nextInd"]];
        }
        
    }
}

- (void)cellCofWithArr:(NSArray *)array indexpath: (NSIndexPath *)indexpath {
    
        NSString *str =array[indexpath.section][indexpath.row][1];
        NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithString:str];
        [att addAttribute:NSFontAttributeName value:kBaseFont_(10) range:[str rangeOfString:@"(9:00-18:00)"]];
        [att addAttribute:NSForegroundColorAttributeName value:kColorRGB(153,153,153) range:[str rangeOfString:@"(9:00-18:00)"]];
        [att addAttribute:NSBaselineOffsetAttributeName value:@(0.36 * (15 - 10)) range:[str rangeOfString:@"(9:00-18:00)"]];
        self.textLabel.attributedText = att;
        
        
        UIButton *btn = [UIButton buttonWithFrame:CGRectMake(0, 0, kScreenW - 15, self.frame.size.height) norImgNamed:nil selImgNamed:nil title:@"400-805-9696" titleColor:kColorRGBA(187,147,115,1) selColor:nil titleFont:14 target:nil selector:nil];
        btn.enabled = NO;
        [btn sizeToFit];
        btn.frame = CGRectMake(kScreenW - 15 - btn.frame.size.width, 0, btn.frame.size.width, self.frame.size.height);
        self.accessoryView = btn;

}
@end
